<template>
  <div>
    <Panle title='配置方式' ></Panle>
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="支付设置"   name="0">
        <div>
          <el-form :model="form"  ref="form"  class="tabform" label-position="center" label-width="120px" >
            <!--        <el-row>-->
            <!--          <el-col :span="12">-->
            <!--            <el-form-item label="配置类型" prop="files_ares">-->
            <!--              <el-radio-group v-model="form.files_ares" @change="radioChange">-->
            <!--                <el-radio :label="0">配置参数</el-radio>-->
            <!--&lt;!&ndash;                <el-radio :label="1">结算配置</el-radio>&ndash;&gt;-->
            <!--              </el-radio-group>-->
            <!--            </el-form-item>-->
            <!--          </el-col>-->
            <!--        </el-row>-->
            <div>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="商户号" prop="mchid">
                    <el-input v-model="form.mchid" size="mini" ></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="Appid" prop="appid">
                    <el-input v-model="form.appid" size="mini" ></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="AppSecret" prop="app_secret">
                    <el-input v-model="form.app_secret" size="mini" ></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="微信支付32位密钥" prop="wx_key">
                    <el-input v-model="form.wx_key" size="mini" ></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="交易完成多少天结算" prop="deal_day">
                    <el-input v-model="form.deal_day" size="mini" style="width: 80px" ></el-input>天
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="清除未支付订单" prop="set_hour">
                    <el-input v-model="form.set_hour" size="mini"  style="width: 80px"></el-input>小时
                  </el-form-item>
                </el-col>
              </el-row>
                <!--
               <el-row>
                <el-col :span="12">
                  <el-form-item label="限购拦截提示语" prop="limited_prompt_msg">
                    <el-input v-model="form.limited_prompt_msg" size="mini"  style="width: 300px"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="老客拦截提示语" prop="old_prompt_msg">
                    <el-input v-model="form.old_prompt_msg" size="mini"  style="width: 300px"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="新客拦截提示语" prop="new_prompt_msg">
                    <el-input v-model="form.new_prompt_msg" size="mini"  style="width: 300px"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
                -->
            </div>
            <!-- 结算设置 -->
            <!--        <div :class="activeName==='1'?'show':'hidden'">-->

            <!--          <el-row>-->
            <!--            <el-col :span="12" >-->
            <!--              <el-form-item label="交易完成多少天结算" prop="deal_day">-->
            <!--                <el-input v-model="form.deal_day" size="mini" style="width: 80px"></el-input>天-->

            <!--              </el-form-item>-->
            <!--            </el-col>-->
            <!--          </el-row>-->
            <!--        </div>-->
            <el-col :span="12">
              <el-form-item label="" >
                <el-button type="primary" size="mini" @click="submitSet">提交数据</el-button>
              </el-form-item>
            </el-col>

          </el-form>
        </div>
      </el-tab-pane>
<!--      <el-tab-pane label="结算设置" name="1"></el-tab-pane>-->
    </el-tabs>

  </div>
</template>

<script>
import {addSettle, getSettleList} from "@/api/sell/settle/settle";

var _self;
import Panle from '@/components/Panle.vue'
import SelectImg from "@/components/select-img.vue";
export default{
  name:"Setup1",
  components:{
    SelectImg,
    Panle
  },
  data(){
    return{
      activeName:'0',
      form:{
        'files_ares':0

      },
      form1:{
        'files_ares':0

      },
    }
  },
  created() {
    _self = this;
    _self.init();
  },
  methods:{
    init:function(){
      getSettleList().then((res)=>{
        _self.form = {...res.data.list};
      })
    },

    handleClick: function(tab, event){
      _self.form.files_ares = Number(tab.name);
    },
    submitSet:function(){
      _self.$refs['form'].validate((valid) =>{
        if (valid) {
          _self.addEditSet();
        } else {
          return false;
        }
      });
    },
    addEditSet:function(){
      addSettle(_self.form).then((res)=>{
        console.log(res);
        _self.msgSuccess(res.msg)
        _self.init();
      })
    },
    radioChange:function(e){

      _self.activeName = e.toString();
    },


    openUploadDial: function () {
      _self.IsShowPicDig = true;
    },
    cleanDiaglog: function () {
      _self.IsShowPicDig = false;
    },
  }

}
</script>

<style lang="scss">
@import "@/assets/css/common";
.el-tabs__item{
  font-size: 12px;
}
.show{
  display: block;
}
.hidden{
  display: none;
}
</style>
